package com.zx.system.block.param;

import com.zx.validation.annotation.ParameterValidation;
import com.zx.validation.enums.ValidateRulesEnum;
import com.zx.validation.groups.Create;
import com.zx.validation.groups.StatusUpdate;
import com.zx.validation.groups.Update;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.Set;

/**
 * <p>
 * description: 部门参数类 <br>
 * create: 2024-10-07 22:50
 * </p>
 *
 * @author zhou  xun
 */
@AllArgsConstructor
@NoArgsConstructor
@Data
public class DeptParam implements Serializable, Create, Update, StatusUpdate {
    /**
     * 部门id
     */
    @ParameterValidation(index = 0, desc = "部门id", rules = {ValidateRulesEnum.NULL_LENGTH}, length = "0~32")
    private String id;

    /**
     * 部门名称
     */
    @ParameterValidation(index = 0, desc = "部门名称", rules = {ValidateRulesEnum.NOT_NULL, ValidateRulesEnum.LENGTH}, length = "0~30")
    private String name;

    /**
     * 邮箱
     */
    @ParameterValidation(index = 0, desc = "邮箱", rules = {ValidateRulesEnum.LENGTH}, length = "0~50")
    private String email;

    /**
     * 联系电话
     */
    @ParameterValidation(index = 0, desc = "联系电话", rules = {ValidateRulesEnum.LENGTH}, length = "0~11")
    private String telephone;

    /**
     * 地址
     */
    @ParameterValidation(index = 0, desc = "地址", rules = {ValidateRulesEnum.LENGTH}, length = "0~200")
    private String address;

    /**
     * logo
     */
    @ParameterValidation(index = 0, desc = "logo", rules = {ValidateRulesEnum.LENGTH}, length = "0~200")
    private String logo;

    /**
     * 父部门id
     */
    @ParameterValidation(index = 0, desc = "父部门id", rules = {ValidateRulesEnum.NULL_LENGTH}, length = "0~32")
    private String parentId;

    /**
     * 显示顺序
     */
    @ParameterValidation(index = 0, desc = "显示顺序", rules = {ValidateRulesEnum.NOT_NULL, ValidateRulesEnum.NON_NEGATIVE_NUMBER})
    private Integer seqNo;

    /**
     * 部门状态(0停用 1启用)
     */
    @ParameterValidation(index = 0, desc = "部门状态", rules = {ValidateRulesEnum.NOT_NULL})
    private Integer status;

    /**
     * 备注
     */
    @ParameterValidation(index = 0, desc = "备注", rules = {ValidateRulesEnum.LENGTH}, length = "0~200")
    private String remark;

    @Override
    public Set<String> getCreateGroupFields() {
        return Set.of("name", "email", "telephone", "address", "logo", "parentId", "seqNo", "status", "remark");
    }

    @Override
    public Set<String> getUpdateGroupFields() {
        return Set.of("id", "name", "email", "telephone", "address", "logo", "parentId", "seqNo", "status", "remark");
    }

    @Override
    public Set<String> getStatusUpdateGroupFields() {
        return Set.of("id", "status");
    }
}